Working with Emacs and SNiFF+

Once a connection between SNiFF+ and Emacs is established, SNiFF+ uses Emacs for all requests to show or edit source code. Emacs also can send queries to SNiFF+.
When you issue an editing request in SNiFF+ and Emacs is not connected to SNiFF+, you are asked whether you want to switch off the Emacs mode and use the Source Editor.

Positioning Emacs from SNiFF+
The Emacs integration offers many of the navigation features available in the Source Editor. For example, by double-clicking on a symbol in any SNiFF+ browser, Emacs loads the corresponding source file and positions the cursor at the appropriate location.
Changing key bindings and Sniff menu entries
The Emacs-SNiFF+ key bindings and the Sniff menu are defined in:

$SNIFF_DIR/config/sniff-mode.el
You can change the SNiFF+ key bindings as for any other Emacs key bindings. The same is true for the Sniff menu.
Configuring symbol highlighting
Emacs can use different fonts. SNiFF+ uses this feature to highlight symbols in source code. As a result, Emacs is able to mimic the Source Editor's symbol highlighting behavior.

- To enable symbol highlighting, enter the following line in your

.emacs file:
(setq sniff-want-fonts 1)
- To switch off symbol highlighting, enter the following line in your
.emacs file:
(setq sniff-want-fonts nil)
The default font table for the highlighting is defined in the sniff-mode.el file. You can change any value in the default font table by setting variables in your .emacs file after sniff-mode.el is loaded. For example, the following line in your .emacs file would tell Emacs to use bold typeface for constants:
(aset sniff-font-table 10 'bold)
Please see the sniff-mode.el file for a full description of table entries.

| Note
| If you have enabled symbol highlighting, but the feature doesn't work, this means that your Emacs might use a font that does not supply the necessary typefaces. The courier font family normally supplies all necessary typefaces. To use this family, add the following X resource to your .Xdefaults file: emacs.font: -*-courier-medium-r-normal--*-120-75-75-*-*-*-*

Using the Sniff menu
Most of the commands described in Command Reference are available in the Sniff menu in Emacs. The following illustration shows the menu:

Switching a non-SNiFF+ buffer to SNiFF+ mode
When a file is loaded in Emacs from SNiFF+, this buffer is automatically in SNiFF+ mode. When you load a file manually (with the Emacs Load file command), you can switch the buffer to SNiFF+ mode with the following command:

M-x sniff-mode
After the command is executed, all SNiFF+ key bindings are available and symbols are highlighted.